package br.com.jk.valealim.cartaotipo;

import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author camilo
 */
@Entity
@Table(name = CartaoTipoDao.NAME_TABLE, schema = CartaoTipoDao.NAME_SCHEMA)

public class CartaoTipo implements Serializable {

  @Id
  @SequenceGenerator(name = CartaoTipoDao.NAME_SEQUENCE, sequenceName = CartaoTipoDao.NAME_SEQUENCE, schema = CartaoTipoDao.NAME_SCHEMA)
  @GeneratedValue(strategy = GenerationType.AUTO, generator = CartaoTipoDao.NAME_SEQUENCE)
  @Column(name = "id")
  private int id;
  @Column(name = "cod", unique = true, length = 6)
  private String cod;
  @Column(name = "nome", nullable = false)
  private String nome;
  @Column(name = "telefone", nullable = false)
  private String telefone;
  @Column(name = "estabelecimento", nullable = false)
  private int estabelecimento;
  @Column(name = "taxa")
  private double taxa;
  @Column(name = "prazo")
  private int prazo;

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getCod() {
    return cod;
  }

  public void setCod(String cod) {
    this.cod = cod;
  }

  public String getNome() {
    return nome;
  }

  public void setNome(String nome) {
    this.nome = nome;
  }

  public String getTelefone() {
    return telefone;
  }

  public void setTelefone(String telefone) {
    this.telefone = telefone;
  }

  public int getEstabelecimento() {
    return estabelecimento;
  }

  public void setEstabelecimento(int estabelecimento) {
    this.estabelecimento = estabelecimento;
  }

  public double getTaxa() {
    return taxa;
  }

  public void setTaxa(double taxa) {
    this.taxa = taxa;
  }

  public int getPrazo() {
    return prazo;
  }

  public void setPrazo(int prazo) {
    this.prazo = prazo;
  }

  @Override
  public int hashCode() {
    int hash = 5;
    hash = 11 * hash + this.id;
    hash = 11 * hash + Objects.hashCode(this.cod);
    hash = 11 * hash + Objects.hashCode(this.nome);
    hash = 11 * hash + Objects.hashCode(this.telefone);
    hash = 11 * hash + this.estabelecimento;
    hash = 11 * hash + (int) (Double.doubleToLongBits(this.taxa) ^ (Double.doubleToLongBits(this.taxa) >>> 32));
    hash = 11 * hash + this.prazo;
    return hash;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final CartaoTipo other = (CartaoTipo) obj;
    if (this.id != other.id) {
      return false;
    }
    if (!Objects.equals(this.cod, other.cod)) {
      return false;
    }
    if (!Objects.equals(this.nome, other.nome)) {
      return false;
    }
    if (!Objects.equals(this.telefone, other.telefone)) {
      return false;
    }
    if (this.estabelecimento != other.estabelecimento) {
      return false;
    }
    if (Double.doubleToLongBits(this.taxa) != Double.doubleToLongBits(other.taxa)) {
      return false;
    }
    if (this.prazo != other.prazo) {
      return false;
    }
    return true;
  }
}
